/*
 * unitTests.c
 *
 *  Created on: Feb 13, 2014
 *      Author: Charles_OSU
 */


#include "unitTests.h"
#include "dominion.h"
#include "helper.h"
#include "rngs.h"
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <stdlib.h>

int cardCost(int supplyPos);
int discardToDeck(struct gameState *state);
int deckToHand(int numCards, struct gameState *state);
int deckToHand2(int numCards, struct gameState *state, int player);
void swap(int pos1, int pos2);

int resetTestState(struct gameState * state){
	free(state);
	state = (struct gameState *) malloc(sizeof(struct gameState));

	state->whoseTurn=0;
	state->numPlayers=2;
	state->numBuys=1;
	state->numActions=1;
	state->phase=1;
	state->costDiff = 0;
	state->copperBonus=0;
	state->additionalCoins=0;
	state->playedCardCount=0;
	state->coins = 0;

	state->handCount[0]=5;
	state->deckCount[0]=5;
	state->discardCount[0]=0;
	state->handCount[1]=5;
	state->deckCount[1]=5;
	state->discardCount[0]=0;

	state->hand[0][0]=estate;
	state->hand[0][1]=copper;
	state->hand[0][2]=copper;
	state->hand[0][3]=curse;
	state->hand[0][4]=gold;
	state->hand[1][0]=estate;
	state->hand[1][1]=copper;
	state->hand[1][2]=copper;
	state->hand[1][3]=copper;
	state->hand[1][4]=copper;


	state->deck[0][0]=estate;
	state->deck[0][1]=estate;
	state->deck[0][2]=copper;
	state->deck[0][3]=copper;
	state->deck[0][4]=copper;
	state->deck[1][0]=estate;
	state->deck[1][1]=estate;
	state->deck[1][2]=copper;
	state->deck[1][3]=copper;
	state->deck[1][4]=copper;
	return 0;
}

int testInitializeGame(){
	int i, j;
	i = j = 0;
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));
	printf("-----------\nTest Initialize Game:\n");
	int k[10] = {adventurer, gardens, council_room, village, minion, pawn, cutpurse, sea_hag, tribute, smithy};

	  int k[10] = {adventurer, council_room, feast, gardens, mine, remodel, smithy, village, baron, great_hall};

	// Test 0 -  initialize game with 2 players
	if(initializeGame(2, k, 10, state) == 0) printf("Test %d -- Passed, initializeGame successful.\n",i);
	else
	{
		printf("Test %d -- Failed initializeGame.\n",i);
		j++;
	}
	i++;
	// Test 1 - Test numPlayers
	if(state->numPlayers == 2) printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, numPlayers was expecting %d but was %d\n",i,2,state->numPlayers);
		j++;
	}
	i++;
	// Test 2 - Test supply count of adventurer
	if(state->supplyCount[adventurer] == 10)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[adventurer] was expecting %d but was %d\n",i,10,state->supplyCount[adventurer]);
		j++;
	}
	i++;
	// Test 3 - Test supply count of gardens
	if(state->supplyCount[gardens] == 8)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[gardens] was expecting %d but was %d\n",i,8,state->supplyCount[gardens]);
		j++;
	}
	i++;
	// Test 4 - Test supply count of remodel
	if(state->supplyCount[remodel] == -1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[remodel] was expecting %d but was %d\n",i,-1,state->supplyCount[remodel]);
		j++;
	}
	i++;
	// Test 5 - Test supply count of curse
	if(state->supplyCount[curse] == 10)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[curse] was expecting %d but was %d\n",i,10,state->supplyCount[curse]);
		j++;
	}
	i++;
	// Test 6 - Test supply count of duchy
	if(state->supplyCount[duchy] == 8)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[duchy] was expecting %d but was %d\n",i,8,state->supplyCount[duchy]);
		j++;
	}
	i++;
	// Test 7 - Test copperBonus
	if(state->copperBonus == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, copperBonus was expecting %d but was %d\n",i,0,state->copperBonus);
		j++;
	}
	i++;
	// Test 8 - Test whoseTurn
	if(state->whoseTurn == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, whoseTurn was expecting %d but was %d\n",i,0,state->whoseTurn);
		j++;
	}
	i++;
	// Test 9 - Test phase
	if(state->phase == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, phase was expecting %d but was %d\n",i,1,state->phase);
		j++;
	}
	i++;
	// Test 10 - Test numActions
	if(state->numActions == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, numActions was expecting %d but was %d\n",i,1,state->numActions);
		j++;
	}
	i++;
	// Test 11 - Test coins
	if(state->coins == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, coins was expecting %d but was %d\n",i,0,state->coins);
		j++;
	}
	i++;
	// Test 12 - Test numBuys
	if(state->numBuys == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, numBuys was expecting %d but was %d\n",i,1,state->numBuys);
		j++;
	}
	i++;
	// Test 13 - Test handCount for player 0
	if(state->handCount[0] == 5)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCount[0] was expecting %d but was %d\n",i,5,state->handCount[0]);
		j++;
	}
	i++;
	// Test 14 - Test handCount for player 1
	if(state->handCount[1] == 5)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCount[1] was expecting %d but was %d\n",i,5,state->handCount[1]);
		j++;
	}
	i++;
	// Test 15 - Test deckCount for player 0
	if(state->deckCount[0] == 5)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, deckCount[0] was expecting %d but was %d\n",i,5,state->deckCount[0]);
		j++;
	}
	i++;
	// Test 16 - Test deckCount for player 1
	if(state->deckCount[1] == 5)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, deckCount[1] was expecting %d but was %d\n",i,5,state->deckCount[1]);
		j++;
	}
	i++;
	// Test 17 - Test discardCount for player 0
	if(state->discardCount[0] == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, discardCount[0] was expecting %d but was %d\n",i,0,state->discardCount[0]);
		j++;
	}
	i++;
	// Test 18 - Test discardCount for player 1
	if(state->discardCount[1] == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, discardCount[1] was expecting %d but was %d\n",i,0,state->discardCount[1]);
		j++;
	}
	i++;
	// Test 19 - Test playedCardCount for player 0
	if(state->playedCardCount == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, playedCardCount was expecting %d but was %d\n",i,0,state->playedCardCount);
		j++;
	}
	i++;

	// test deck and hands for each player
	int estates[2];
	int coppers[2];
	estates[0]=estates[1]=coppers[0]=coppers[1]=0;
	int x,y;
	for(x=0;x<state->numPlayers;x++)
	{
		for(y=0;y<state->deckCount[x];y++)
		{
			if(state->deck[x][y]==estate) estates[x]++;
			else if(state->deck[x][y]==copper) coppers[x]++;
		}
		for(y=0;y<state->handCount[x];y++)
		{
			if(state->hand[x][y]==estate) estates[x]++;
			else if(state->hand[x][y]==copper) coppers[x]++;
		}
	}
	// Test 20 - Tests that it found 3 estates for player 0, if not it prints how many estates
	if(estates[0] == 3)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, # of estates[0] was expecting 3 but was %d\n",i,estates[0]);
		j++;
	}
	i++;
	// Test 21 - Tests that if found 7 coppers for player 0, if not it prints how many coppers
	if(coppers[0] == 7)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, # of coppers[0] was expecting 7 but was %d\n",i,coppers[0]);
		j++;
	}
	i++;
	// Test 22 - Tests that it found 3 estates for player 1, if not prints how many estates it found
	if(estates[1] == 3)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, # of estates[1] was expecting 3 but was %d\n",i,estates[1]);
		j++;
	}
	i++;
	// Test 23 - Tests that if found 7 copper for player 1, if not prints how many copper if found
	if(coppers[1] == 7)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, # of coppers[1] was expecting 7 but was %d\n",i,coppers[1]);
		j++;
	}
	i++;

	free(state);
	state = (struct gameState *) malloc(sizeof(struct gameState));

	// Test 24 -  initialize game with 3 players
	if(initializeGame(3, k, 10, state) == 0) printf("Test %d -- Passed, initializeGame succeeded\n",i);
	else
	{
		printf("Test %d -- Failed, initializeGame.\n",i);
		j++;
	}
	i++;

	// Test 25 - Test numPlayers
	if(state->numPlayers == 3) printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, numPlayers was expecting %d but was %d\n",i,3,state->numPlayers);
		j++;
	}
	i++;

	// Test 26 - Test supply count of gardens
	if(state->supplyCount[gardens] == 12)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[gardens] was expecting %d but was %d\n",i,12,state->supplyCount[gardens]);
		j++;
	}
	i++;

	// Test 27 - Test supply count of estate
	if(state->supplyCount[estate] == 3)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[estate] was expecting %d but was %d\n",i,3,state->supplyCount[estate]);
		j++;
	}
	i++;

	// Test 28 - Test supply count of duchy
	if(state->supplyCount[duchy] == 12)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[duchy] was expecting %d but was %d\n",i,12,state->supplyCount[duchy]);
		j++;
	}
	i++;

	// Test 29 - Test supply count of province
	if(state->supplyCount[province] == 12)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[province] was expecting %d but was %d\n",i,12,state->supplyCount[province]);
		j++;
	}
	i++;

	// Test 30 - Test supply count of curse
	if(state->supplyCount[curse] == 20)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[curse] was expecting %d but was %d\n",i,20,state->supplyCount[curse]);
		j++;
	}
	i++;

	free(state);
	state = (struct gameState *) malloc(sizeof(struct gameState));

	// Test 31 -  initialize game with 4 players
	if(initializeGame(4, k, 10, state) == 0) printf("Test %d -- Passed, initializeGame\n",i);
	else
	{
		printf("Test %d -- Failed, initializeGame.\n",i);
		j++;
	}
	i++;

	// Test 32 - Test numPlayers
	if(state->numPlayers == 4) printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, numPlayers was expecting %d but was %d\n",i,4,state->numPlayers);
		j++;
	}
	i++;

	// Test 33 - Test supply count of gardens
	if(state->supplyCount[gardens] == 12)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[gardens] was expecting %d but was %d\n",i,12,state->supplyCount[gardens]);
		j++;
	}
	i++;

	// Test 34 - Test supply count of estate
	if(state->supplyCount[estate] == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[estate] was expecting %d but was %d\n",i,0,state->supplyCount[estate]);
		j++;
	}
	i++;

	// Test 35 - Test supply count of duchy
	if(state->supplyCount[duchy] == 12)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[duchy] was expecting %d but was %d\n",i,12,state->supplyCount[duchy]);
		j++;
	}
	i++;

	// Test 36 - Test supply count of province
	if(state->supplyCount[province] == 12)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[province] was expecting %d but was %d\n",i,12,state->supplyCount[province]);
		j++;
	}
	i++;

	// Test 37 - Test supply count of curse
	if(state->supplyCount[curse] == 30)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount[curse] was expecting %d but was %d\n",i,30,state->supplyCount[curse]);
		j++;
	}
	i++;
	free(state);
	state = (struct gameState *) malloc(sizeof(struct gameState));
	// Test 38 -  initialize game with 5 players
	if(initializeGame(5, k, 10, state) == -1) printf("Test %d -- Passed, initializeGame.\n",i);
	else
	{
		printf("Test %d -- Failed, initializeGame.\n",i);
		j++;
	}
	i++;
	free(state);
	state = (struct gameState *) malloc(sizeof(struct gameState));
	// Test 39 -  initialize game with 1 players
	if(initializeGame(1, k, 10, state) == -1) printf("Test %d -- Passed, initializeGame.\n",i);
	else
	{
		printf("Test %d -- Failed, initializeGame.\n",i);
		j++;
	}
	i++;
	free(state);
	state = (struct gameState *) malloc(sizeof(struct gameState));
	// Test 40 -  initialize game with 0 players
	if(initializeGame(0, k, 10, state) == -1) printf("Test %d -- Passed, initializeGame.\n",i);
	else
	{
		printf("Test %d -- Failed, initializeGame.\n",i);
		j++;
	}
	i++;
	free(state);
	state = (struct gameState *) malloc(sizeof(struct gameState));
	// Test 41 -  initialize game with -1 players
	if(initializeGame(-1, k, 10, state) == -1) printf("Test %d -- Passed, initializeGame.\n",i);
	else
	{
		printf("Test %d -- Failed, initializeGame.\n",i);
		j++;
	}
	i++;
	free(state);
	state = (struct gameState *) malloc(sizeof(struct gameState));
	// Test 42 -  initialize game with 10 players
	if(initializeGame(10, k, 10, state) == -1) printf("Test %d -- Passed, initializeGame.\n",i);
	else
	{
		printf("Test %d -- Failed, initializeGame.\n",i);
		j++;
	}
	i++;
	free(state);
	state = (struct gameState *) malloc(sizeof(struct gameState));
	k[1]=gold;
	// Test 43 -  initialize game with 2 players and kingdom cards out of range (gold)
	if(initializeGame(2, k, 10, state) == -1) printf("Test %d -- Passed, initializeGame.\n",i);
	else
	{
		printf("Test %d -- Failed, initializeGame.\n",i);
		j++;
	}
	i++;
	free(state);
	state = (struct gameState *) malloc(sizeof(struct gameState));
	k[1] = treasure_map+1;
	// Test 44 -  initialize game with 2 players and kingdom cards out of range (treasure_map+1)
	if(initializeGame(2, k, 10, state) == -1) printf("Test %d -- Passed, initializeGame.\n",i);
	else
	{
		printf("Test %d -- Failed, initializeGame.\n",i);
		j++;
	}
	i++;
	free(state);
	printf("Finished Testing Initialize Game.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testBuyCard(){
	int i, j;
	i = j = 0;
	printf("-----------\nTest Buy Card:\n");
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));
	int k[10] = {adventurer, gardens, council_room, village, minion, pawn, cutpurse, sea_hag, tribute, smithy};
	initializeGame(2, k, 10, state);
	state->whoseTurn = 0;
	state->phase=2;
	if(state->numBuys == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"numBuys",1,state->numBuys);
		j++;
	}
	i++;
	if(buyCard(copper, state) == 0)printf("Test %d -- Passed, buyCard.\n",i);
	else
	{
		printf("Test %d -- Failed, buyCard.\n",i);
		j++;
	}
	i++;
	if(state->numBuys == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"numBuys",0,state->numBuys);
		j++;
	}
	i++;
	if(state->discardCount[0] == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"discardCount[0]",1,state->discardCount[0]);
		j++;
	}
	i++;
	if(state->discard[0][0] == copper)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"discard[0][0]",copper,state->discard[0][0]);
		j++;
	}
	i++;
	if(buyCard(copper, state) == -1)printf("Test %d -- Passed, buyCard.\n",i);
	else
	{
		printf("Test %d -- Failed, buyCard.\n",i);
		j++;
	}
	i++;

	free(state);
	state = (struct gameState *) malloc(sizeof(struct gameState));
	initializeGame(2, k, 10, state);
	state->whoseTurn = 0;
	state->phase=2;
	if(state->numBuys == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"numBuys",1,state->numBuys);
		j++;
	}
	i++;
	if(buyCard(adventurer, state) == -1)printf("Test %d -- Passed, buyCard.\n",i);
	else
	{
		printf("Test %d -- Failed, buyCard.\n",i);
		j++;
	}
	i++;
	if(state->numBuys == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"numBuys",1,state->numBuys);
		j++;
	}
	i++;
	if(buyCard(festival, state) == -1)printf("Test %d -- Passed, buyCard.\n",i);
	else
	{
		printf("Test %d -- Failed, buyCard.\n",i);
		j++;
	}
	i++;
	if(state->numBuys == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"numBuys",1,state->numBuys);
		j++;
	}
	i++;
	if(buyCard(pawn, state) == 0)printf("Test %d -- Passed, buyCard.\n",i);
	else
	{
		printf("Test %d -- Failed, buyCard.\n",i);
		j++;
	}
	i++;
	if(state->numBuys == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"numBuys",0,state->numBuys);
		j++;
	}
	i++;
	if(state->discardCount[0] == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"discardCount[0]",1,state->discardCount[0]);
		j++;
	}
	i++;
	if(state->discard[0][0] == copper)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"discard[0][0]",copper,state->discard[0][0]);
		j++;
	}
	i++;

	free(state);
	printf("Finished Testing Buy Card.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testNumHandCards(){
	int i, j;
	i = j = 0;
	printf("-----------\nTest Num Hand Cards:\n");
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));
	state->whoseTurn = 0;
	state->handCount[0] =5;
	if(numHandCards(state) == 5)printf("Test %d -- Passed, numHandCards.\n",i);
	else
	{
		printf("Test %d -- Failed, numHandCards should have been 5.\n",i);
		j++;
	}
	i++;
	state->whoseTurn = 1;
	state->handCount[1] = 7;
	if(numHandCards(state) == 7)printf("Test %d -- Passed, numHandCards.\n",i);
	else
	{
		printf("Test %d -- Failed, numHandCards should have been 7.\n",i);
		j++;
	}
	i++;
	state->whoseTurn = 2;
	state->handCount[2] =0;
	if(numHandCards(state) == 0)printf("Test %d -- Passed, numHandCards.\n",i);
	else
	{
		printf("Test %d -- Failed, numHandCards should have been 0.\n",i);
		j++;
	}
	i++;
	free(state);
	printf("Finished Testing Num Hand Cards.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testHandCard(){
	int i, j;
	i = j = 0;
	printf("-----------\nTest Hand Card:\n");
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));
	state->whoseTurn = 0;
	state->hand[0][0] = 0;
	state->hand[0][1] = 1;
	state->hand[0][2] = 2;
	state->hand[0][3] = 3;
	state->hand[0][4] = 4;
	state->hand[0][5] = 5;
	state->hand[0][6] = 6;
	state->handCount[0] = 3;
	if(handCard(-1,state) == -1)printf("Test %d -- Passed, handCard.\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been -1.\n",i);
	j++;	}
	i++;
	if(handCard(0,state) == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been 0.\n",i);
		j++;
	}
	i++;
	if(handCard(1,state) == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been 1.\n",i);
		j++;
	}
	i++;
	if(handCard(2,state) == 2)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been 2.\n",i);
		j++;
	}
	i++;
	if(handCard(3,state) == -1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been -1.\n",i);
		j++;
	}
	i++;
	if(handCard(4,state) == -1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been -1.\n",i);
		j++;
	}
	i++;
	if(handCard(5,state) == -1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been -1.\n",i);
		j++;
	}
	i++;
	state->handCount[0] = 5;
	if(handCard(0,state) == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been 0.\n",i);
		j++;
	}
	i++;
	if(handCard(1,state) == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been 1.\n",i);
		j++;
	}
	i++;
	if(handCard(2,state) == 2)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been 2.\n",i);
		j++;
	}
	i++;
	if(handCard(3,state) == 3)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been 3.\n",i);
		j++;
	}
	i++;
	if(handCard(4,state) == 4)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been 4.\n",i);
		j++;
	}
	i++;
	if(handCard(5,state) == -1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been -1.\n",i);
		j++;
	}
	i++;
	state->handCount[0] = 6;
	if(handCard(0,state) == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been 0.\n",i);
		j++;
	}
	i++;
	if(handCard(1,state) == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been 1.\n",i);
		j++;
	}
	i++;
	if(handCard(2,state) == 2)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been 2.\n",i);
		j++;
	}
	i++;
	if(handCard(3,state) == 3)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been 3.\n",i);
		j++;
	}
	i++;
	if(handCard(4,state) == 4)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been 4.\n",i);
		j++;
	}
	i++;
	if(handCard(5,state) == 5)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been 5.\n",i);
		j++;
	}
	i++;
	if(handCard(6,state) == -1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, handCard should have been -1.\n",i);
		j++;
	}
	i++;
	free(state);
	printf("Finished Testing Hand Card.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testSupplyCount(){
	int i, j;
	i = j = 0;
	printf("-----------\nTest Supply Count:\n");
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));
	int k[10] = {adventurer, treasure_map, council_room, village, gardens, pawn, cutpurse, sea_hag, tribute, smithy};
	initializeGame(2, k, 10, state);
	if(supplyCount(-1, state) == -1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount should have been -1.\n",i);
		j++;
	}
	i++;
	if(supplyCount(35, state) == -1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount should have been -1.\n",i);
		j++;
	}
	i++;
	if(supplyCount(curse, state) == 10)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount should have been 10.\n",i);
		j++;
	}
	i++;
	if(supplyCount(0, state) == 10)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount should have been 10.\n",i);
		j++;
	}
	i++;
	if(supplyCount(treasure_map, state) == 10)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount should have been 10.\n",i);
		j++;
	}
	i++;
	if(supplyCount(34, state) == 10)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount should have been 10.\n",i);
		j++;
	}
	i++;
	if(supplyCount(adventurer, state) == 10)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount should have been 10.\n",i);
		j++;
	}
	i++;
	if(supplyCount(smithy, state) == 10)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount should have been 10.\n",i);
		j++;
	}
	i++;
	if(supplyCount(minion, state) == -1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, supplyCount should have been -1.\n",i);
		j++;
	}
	i++;
	free(state);
	printf("Finished Testing Supply Count.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testFullDeckCount(){
	int i, j;
	i = j = 0;
	printf("-----------\nTest Full Deck Count:\n");
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));

	// hand
	state->handCount[0] = 5;
	state->hand[0][0] = 1;
	state->hand[0][1] = 1;
	state->hand[0][2] = 1;
	state->hand[0][3] = 1;
	state->hand[0][4] = 1;

	// deck
	state->deckCount[0] = 5;
	state->deck[0][0] = 3;
	state->deck[0][1] = 4;
	state->deck[0][2] = 3;
	state->deck[0][3] = 4;
	state->deck[0][4] = 1;

	// discard
	state->discardCount[0] = 0;
	state->discard[0][0] = 1;
	state->discard[0][1] = 1;
	state->discard[0][2] = 3;
	state->discard[0][3] = 4;
	state->discard[0][4] = 1;

	// Test 0 -  no discard
	if(fullDeckCount(0,1, state) == 6)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, fullDeckCount should have been 6.\n",i);
		j++;
	}
	i++;

	// Test 1 - only hand
	state->deckCount[0] = 0;
	state->discardCount[0] = 0;
	if(fullDeckCount(0,1, state) == 5)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, fullDeckCount should have been 5.\n",i);
		j++;
	}
	i++;

	// Test 2 - no cards
	state->handCount[0] = 0;
	state->deckCount[0] = 0;
	state->discardCount[0] = 0;
	if(fullDeckCount(0,1, state) == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, fullDeckCount should have been 0.\n",i);
		j++;
	}
	i++;

	// Test 3 - all have cards
	state->handCount[0] = 5;
	state->deckCount[0] = 5;
	state->discardCount[0] = 5;
	if(fullDeckCount(0,1, state) == 9)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, fullDeckCount should have been 9.\n",i);
		j++;
	}
	i++;

	// Test 4 - all have cards, look for card not in deck
	state->handCount[0] = 5;
	state->deckCount[0] = 5;
	state->discardCount[0] = 5;
	if(fullDeckCount(0,shanty_town, state) == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, fullDeckCount should have been 0.\n",i);
		j++;
	}
	i++;


	free(state);
	printf("Finished Testing Full Deck Count.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testWhoseTurn(){
	int i, j;
	i = j = 0;
	printf("-----------\nTest Whose Turn:\n");
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));

	state->numPlayers=2;
	state->whoseTurn=0;
	if(whoseTurn(state)==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, whoseTurn should have been 0.\n",i);
		j++;
	}
	i++;
	state->whoseTurn = -10;
	if(whoseTurn(state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, whoseTurn should have been -1.\n",i);
		j++;
	}
	i++;

	state->whoseTurn=-1;
	if(whoseTurn(state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, whoseTurn should have been -1.\n",i);
		j++;
	}
	i++;

	state->whoseTurn=MAX_PLAYERS+1;
	if(whoseTurn(state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, whoseTurn should have been -1.\n",i);
		j++;
	}
	i++;


	state->whoseTurn=6;
	if(whoseTurn(state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, whoseTurn should have been -1.\n",i);
		j++;
	}
	i++;

	state->whoseTurn=3;
	if(whoseTurn(state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, whoseTurn should have been 3.\n",i);
		j++;
	}
	i++;

	state->whoseTurn=4;
	if(whoseTurn(state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, whoseTurn should have been 4.\n",i);
		j++;
	}
	i++;

	free(state);
	printf("Finished Testing Whose Turn.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testEndTurn(){
	int i, j;
	i = j = 0;
	printf("-----------\nTest End Turn:\n");
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));
	state->whoseTurn=0;
	state->numPlayers=2;
	state->numBuys=0;
	state->numActions=0;
	state->phase=3;
	state->costDiff = 1;
	state->copperBonus=1;
	state->additionalCoins=1;
	state->playedCardCount=1;
	state->coins = 0;

	state->handCount[0]=5;
	state->deckCount[0]=5;
	state->discardCount[0]=0;
	state->handCount[1]=5;
	state->deckCount[1]=5;
	state->discardCount[0]=0;

	state->playedCards[0]=20;

	state->hand[0][0]=1;
	state->hand[0][1]=2;
	state->hand[0][2]=3;
	state->hand[0][3]=4;
	state->hand[0][4]=5;
	state->hand[1][0]=estate;
	state->hand[1][1]=copper;
	state->hand[1][2]=copper;
	state->hand[1][3]=copper;
	state->hand[1][4]=copper;


	state->deck[0][0]=6;
	state->deck[0][1]=7;
	state->deck[0][2]=8;
	state->deck[0][3]=9;
	state->deck[0][4]=10;
	state->deck[1][0]=estate;
	state->deck[1][1]=estate;
	state->deck[1][2]=copper;
	state->deck[1][3]=copper;
	state->deck[1][4]=copper;

	// Test 0 - endTurn of player 0
	if( endTurn(state) == 0)printf("Test %d -- Passed, endTurn.\n",i);
	else
	{
		printf("Test %d -- Failed, endTurn.\n",i);
		j++;
	}
	i++;

	// Test 1 - whoseTurn should be 1
	if( state->whoseTurn == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"whoseTurn",1,state->whoseTurn);
		j++;
	}
	i++;

	// Test 2 - phase should be 1
	if( state->phase == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"phase",1,state->phase);
		j++;
	}
	i++;

	// Test 3 - numBuys should be 1
	if( state->numBuys == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"numBuys",1,state->numBuys);
		j++;
	}
	i++;

	// Test 4 - numActions should be 1
	if( state->numActions == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"numActions",1,state->numActions);
		j++;
	}
	i++;

	// Test 5 - copperBonus should be 0
	if( state->copperBonus == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"copperBonus",0,state->copperBonus);
		j++;
	}
	i++;

	// Test 6 - coins should be 0
	if( state->coins == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"coins",0,state->coins);
		j++;
	}
	i++;

	// Test 7 - additionalCoins should be 0
	if( state->additionalCoins == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"additionalCoins",0,state->additionalCoins);
		j++;
	}
	i++;

	// Test 8 - costDiff should be 0
	if( state->costDiff == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"costDiff",0,state->costDiff);
		j++;
	}
	i++;

	// Test 9 - playedCardCount should be 0
	if( state->playedCardCount == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"playedCardCount",0,state->playedCardCount);
		j++;
	}
	i++;

	// Test 10 - deckCount should be 0
	if( state->deckCount[0] == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"deckCount",0,state->deckCount[0]);
		j++;
	}
	i++;

	// Test 11 - handCount should be 5
	if( state->handCount[0] == 5)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"handCount[0]",0,state->handCount[0]);
		j++;
	}
	i++;

	// Test 12 - hand[0][0] should be 10
	if( state->hand[0][0] == 10)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][0]",10,state->hand[0][0]);
		j++;
	}
	i++;

	// Test 13 - hand[0][1] should be 9
	if( state->hand[0][1] == 9)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][1]",9,state->hand[0][1]);
		j++;
	}
	i++;

	// Test 14 - hand[0][2] should be 8
	if( state->hand[0][2] == 8)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][2]",8,state->hand[0][2]);
		j++;
	}
	i++;

	// Test 15 - hand[0][4] should be 6
	if( state->hand[0][4] == 6)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][4]",6,state->hand[0][4]);
		j++;
	}
	i++;


	// Test 16 - discardCount should be 5
	if( state->discardCount[0] == 5)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"discardCount[0]",5,state->discardCount[0]);
		j++;
	}
	i++;

	// Test 17 - discard[0][0] should be 5
	if( state->discard[0][0] == 5)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"discard[0][0]",5,state->discard[0][0]);
		j++;
	}
	i++;

	// Test 18 - discard[0][4] should be 1
	if( state->discard[0][4] == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"discard[0][4]",1,state->discard[0][4]);
		j++;
	}
	i++;

	state->phase=3;

	// Test 19 - endTurn of player 1
	if( endTurn(state) == 0)printf("Test %d -- Passed, endTurn.\n",i);
	else
	{
		printf("Test %d -- Failed, endTurn.\n",i);
		j++;
	}
	i++;

	// Test 20 - whoseTurn should be 0
	if( state->whoseTurn == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"whoseTurn",1,state->whoseTurn);
		j++;
	}
	i++;

	free(state);
	printf("Finished Testing End Turn.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testIsGameOver(){
	int i, j;
	i = j = 0;
	printf("-----------\nTest Is Game Over:\n");
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));

	int k[10] = {adventurer, gardens, council_room, village, minion, pawn, cutpurse, sea_hag, tribute, smithy};
	initializeGame(2, k, 10, state);

	if(isGameOver(state)==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, isGameOver should have been 0.\n",i);
		j++;
	}
	i++;

	state->supplyCount[province]=0;
	if(isGameOver(state)==1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, isGameOver should have been 1.\n",i);
		j++;
	}
	i++;
	state->supplyCount[province]=8;


	state->supplyCount[adventurer]=0;
	if(isGameOver(state)==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, isGameOver should have been 0.\n",i);
		j++;
	}
	i++;

	state->supplyCount[gardens]=0;
	if(isGameOver(state)==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, isGameOver should have been 0.\n",i);
		j++;
	}
	i++;

	state->supplyCount[laboratory]=0;
	if(isGameOver(state)==1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, isGameOver should have been 1.\n",i);
		j++;
	}
	i++;

	state->supplyCount[village]=0;
	if(isGameOver(state)==1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, isGameOver should have been 1.\n",i);
		j++;
	}
	i++;


	free(state);
	printf("Finished Testing Is Game Over.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testScoreFor(){
	int i, j,k;
	i = j = 0;
	printf("-----------\nTest Score For:\n");
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));

	state->handCount[0]=5;
	state->deckCount[0]=5;
	state->discardCount[0]=5;
	for(k=0;k<5;k++){
		state->hand[0][k]=copper;
		state->discard[0][k]=copper;
		state->deck[0][k]=copper;
	}
/* first 8 tests will test as if FullDeckCount functions correctly
	FullDeckCount counts only the cards in hand
*/
	// Test 0 Score of 0
	if(scoreFor(0, state)==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, scoreFor should have been 0.\n",i);
		j++;
	}
	i++;

	state->discard[0][3] = estate;
	state->deck[0][2]=estate;
	state->hand[0][1]=estate;
	// Test 1 Score of 3 estates, one in each container
	if(scoreFor(0, state)==3)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, scoreFor should have been 3.\n",i);
		j++;
	}
	i++;


	state->deck[0][2]=duchy;
	state->discard[0][4]=duchy;

	// Test 2 Score of 2 estates and 2 duchy
	if(scoreFor(0, state)== 8)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, scoreFor should have been 8.\n",i);
		j++;
	}
	i++;

	state->discard[0][3] = estate;
	state->discard[0][4] = duchy;
	state->deck[0][2]=estate;
	state->hand[0][1]=duchy;
	state->deck[0][0]=province;
	// Test 3 Score of 2 estates, 1 province and 2 duchy
	if(scoreFor(0, state)== (2+3*2+6))printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, scoreFor should have been %d\n",i,2+3*2+6);
		j++;
	}
	i++;


	state->discard[0][3] = estate;
	state->discard[0][4] = duchy;
	state->deck[0][2]=great_hall;
	state->hand[0][1]=duchy;
	state->deck[0][0]=province;
	// Test 4 Score of 1 estate, 1 great_hall, 1 province and 2 duchy
	if(scoreFor(0, state)== (2+3*2+6))printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, scoreFor should have been %d.\n",i,2+3*2+6);
		j++;
	}
	i++;

	state->discard[0][3] = estate;
	state->discard[0][4] = duchy;
	state->deck[0][2]=great_hall;
	state->hand[0][1]=gardens;
	state->deck[0][0]=province;
	// Test 5 Score of 1 estate, 1 great_hall, 1 province, 1 duchy and 1 garden
	if(scoreFor(0, state)== (2+3+6+10))printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, scoreFor should have been %d.\n",i,2+3+6+10);
		j++;
	}
	i++;

	state->discard[0][3] = estate;
	state->discard[0][4] = duchy;
	state->deck[0][2]=great_hall;
	state->hand[0][1]=duchy;
	state->hand[0][0]=duchy;
	state->deck[0][0]=province;
	// Test 6 Score of 1 estate, 1 great_hall, 1 province, 1 duke and 2 duchy
	if(scoreFor(0, state)== (2+3*2+6+2))printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, scoreFor should have been %d.\n",i,2+3*2+6+2);
		j++;
	}
	i++;

	state->discard[0][3] = estate;
	state->discard[0][4] = duchy;
	state->deck[0][2]=great_hall;
	state->hand[0][1]=duchy;
	state->hand[0][0]=duchy;
	state->deck[0][0]=province;
	state->discard[0][0] = curse;
	state->discard[0][1] = curse;
	// Test 7 Score of 1 estate, 1 great_hall, 1 province, 1 duke, 2 curses and 2 duchy
	if(scoreFor(0, state)== (2+3*2+6))printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, scoreFor should have been %d.\n",i,2+3*2+6);
		j++;
	}
	i++;

// Begin tests for broken full deck count

	state->discardCount[0]=0;
	state->deckCount[0]=0;


	state->hand[0][0]=estate;
	state->hand[0][1]=duchy;
	state->hand[0][2]=great_hall;
	state->hand[0][3]=province;
	state->hand[0][4]=duke;
	// Test 8 Score of 1 estate, 1 great_hall, 1 province, 1 duke and 2 duchy
	if(scoreFor(0, state)== (1+3+1+6+1))printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, scoreFor should have been %d.\n",i,1+3+1+6+1);
		j++;
	}
	i++;

	state->handCount[0]=6;
	state->hand[0][5]=curse;
	// Test 9 Score of 1 estate, 1 great_hall, 1 province, 1 duke and 2 duchy -1 curse
	if(scoreFor(0, state)== (1+3+1+6+1-1))printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, scoreFor should have been %d.\n",i,1+3+1+6+1-1);
		j++;
	}
	i++;


	for(k=0;k<4;k++){
		state->hand[0][k]=copper;
	}
	state->hand[0][4]=gardens;
	state->handCount[0]=5;
	state->discardCount[0]=5;
	state->deckCount[0]=5;
	for(k=0;k<4;k++){
		state->hand[0][k]=copper;
	}
	state->hand[0][4]=gardens;
	// Test 10 Score of 3 gardens
	if(scoreFor(0, state)== 30)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, scoreFor should have been %d.\n",i,30);
		j++;
	}
	i++;

	free(state);
	printf("Finished Testing Score For.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testGetWinners(){
	int i, j,k,l,players[4];
	printf("-----------\nTest Get Winners:\n");
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));

	state->numPlayers =2;
	for(l=0;l<2;l++) {
		state->handCount[l]=5;
		state->deckCount[l]=5;
		state->discardCount[l]=5;
		for(k=0;k<4;k++){
			state->hand[l][k]=copper;
			state->discard[l][k]=copper;
			state->deck[l][k]=copper;
		}
	}
	// score for player 0 will be 3
	state->hand[0][4] = estate;
	state->discard[0][4] = estate;
	state->deck[0][4] = estate;

	// score for player 1 will be 9
	state->hand[1][4] = duchy;
	state->discard[1][4] = duchy;
	state->deck[1][4] = duchy;

	/* Will test as if FullDeckCount functions correctly
	 FullDeckCount counts only the cards in hand, so we will put the same cards in hand, discard and deck
	 */
	i=0;
	j=0;
	// test 1, player 1 wins
	if(getWinners(players, state) == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"getWinners",1,getWinners(players, state));
		j++;
	}
	i++;

	// score for player 0 will be 18
	state->hand[0][4] = province;
	state->discard[0][4] = province;
	state->deck[0][4] = province;

	// test 2, player 0 wins
	if(getWinners(players, state) == 0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"getWinners",0,getWinners(players, state));
		j++;
	}
	i++;
	free(state);
	printf("Finished Testing Get Winners.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testCardCost(){
	int i, j;
	i = j = 0;
	printf("-----------\nTest Card Cost:\n");

	for (i=curse;i<treasure_map+1;i++) {
		if(cardCost(i)<0)printf("cardCost failed for card %d",i);
	}

	i=0;
	if(cardCost(curse)==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"cardCost(curse)",0,cardCost(curse));
		j++;
	}
	i++;

	if(cardCost(estate)==2)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"cardCost(estate)",2,cardCost(estate));
		j++;
	}
	i++;

	if(cardCost(duchy)==5)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"cardCost(duchy)",5,cardCost(duchy));
		j++;
	}
	i++;

	if(cardCost(treasure_map)==4)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"cardCost(treasure_map)",4,cardCost(treasure_map));
		j++;
	}
	i++;

	if(cardCost(-1)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"cardCost(-1)",-1,cardCost(-1));
		j++;
	}
	i++;

	if(cardCost(treasure_map+1)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"cardCost(treasure_map+1)",-1,cardCost(treasure_map+1));
		j++;
	}
	i++;

	printf("Finished Testing Card Cost.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testPlayCard(){
	int i, j, ic;
	i = j = 0;
	printf("-----------\nTest Play Card:\n");
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));

	state->whoseTurn=0;
	state->numPlayers=2;
	state->numBuys=1;
	state->numActions=1;
	state->phase=1;

	state->handCount[0]=5;
	state->deckCount[0]=5;
	state->handCount[1]=5;
	state->deckCount[1]=5;

	state->hand[0][0]=estate;
	state->hand[0][1]=copper;
	state->hand[0][2]=copper;
	state->hand[0][3]=curse;
	state->hand[0][4]=gold;
	state->hand[1][0]=estate;
	state->hand[1][1]=copper;
	state->hand[1][2]=copper;
	state->hand[1][3]=copper;
	state->hand[1][4]=copper;


	state->deck[0][0]=estate;
	state->deck[0][1]=estate;
	state->deck[0][2]=copper;
	state->deck[0][3]=copper;
	state->deck[0][4]=copper;
	state->deck[1][0]=estate;
	state->deck[1][1]=estate;
	state->deck[1][2]=copper;
	state->deck[1][3]=copper;
	state->deck[1][4]=copper;


	// Test 0 - Try to play an estate
	if(playCard(0, 0, 0, 0, state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, playCard should have been -1.\n",i);
		j++;
	}
	i++;

	state->numActions=1;
	// Test 1 - Try to play a copper
	if(playCard(1, 0, 0, 0, state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, playCard should have been -1.\n",i);
		j++;
	}
	i++;

	state->numActions=1;
	// Test 2 - Try to play a gold
	if(playCard(4, 0, 0, 0, state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, playCard should have been -1.\n",i);
		j++;
	}
	i++;

	state->numActions=1;
	// Test 3 - Try to play a curse
	if(playCard(3, 0, 0, 0, state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, playCard should have been -1.\n",i);
		j++;
	}
	i++;

	state->numActions=1;
	// Test 4 - Try to play a card not in hand (-1)
	if(playCard(-1, 0, 0, 0, state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, playCard should have been -1.\n",i);
		j++;
	}
	i++;

	state->numActions=1;
	state->hand[0][5]=bridge;
	// Test 5 - Try to play a card > handCount (5)
	if(playCard(5, 0, 0, 0, state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, playCard should have been -1.\n",i);
		j++;
	}
	i++;

	state->numActions=1;
	state->handCount[0]=4;
	state->hand[0][4]=bridge;
	// Test 6 - Try to play a card > handCount (4)
	if(playCard(4, 0, 0, 0, state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, playCard should have been -1.\n",i);
		j++;
	}
	i++;

	state->numActions=1;
	state->handCount[0]=5;
	state->phase=2;
	// Test 7 - Try to play a card when in buy phase
	if(playCard(4, 0, 0, 0, state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, playCard should have been -1.\n",i);
		j++;
	}
	i++;

	state->numActions=1;
	state->phase=3;
	// Test 8 - Try to play a card when in final phase
	if(playCard(4, 0, 0, 0, state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, playCard should have been -1.\n",i);
		j++;
	}
	i++;
	state->phase=1;

	state->numActions=0;
	// Test 9 - Try to play a card without any actions
	if(playCard(4, 0, 0, 0, state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, playCard should have been -1.\n",i);
		j++;
	}
	i++;
	state->numActions=1;

	state->hand[0][4]=treasure_map+1;
	// Test 10 - Try to play a card > treasure map
	if(playCard(4, 0, 0, 0, state)==-1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, playCard should have been -1.\n",i);
		j++;
	}
	i++;

// >> Test Adventure
	printf("-----Testing Adventure-----\n");
	ic =0;

	state->hand[0][0]=estate;
	state->hand[0][1]=copper;
	state->hand[0][2]=copper;
	state->hand[0][3]=adventurer;
	state->hand[0][4]=gold;


	state->deck[0][0]=estate;
	state->deck[0][1]=estate;
	state->deck[0][2]=copper;
	state->deck[0][3]=copper;
	state->deck[0][4]=copper;



	state->numActions=1;
	// Test 0 - Test if playCard succeeds
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - Hand Count should now be 7 for the two new estates - 1 for the played card == 6
	if(state->handCount[0]==6)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",6,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 2 - Deck Count should be 3, drew 2 cards
	if(state->deckCount[0]==3)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",3,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 3 - Discard count should still be 0, shouldn't have needed to discard anything
	if(state->discardCount[0]==0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"discardCount[0]",0,state->discardCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 4 - hand [4] and [5] should both be copper
	if(state->hand[0][4] == copper && state->hand[0][5]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, hand[0][4] and hand[0][5] should have been copper.\n",ic);
		j++;
	}
	i++;
	ic++;


	//	reset deck, discard and hand
	state->deckCount[0]=5;
	state->handCount[0]=5;
	state->discardCount[0]=0;

	state->hand[0][0]=estate;
	state->hand[0][1]=copper;
	state->hand[0][2]=copper;
	state->hand[0][3]=adventurer;
	state->hand[0][4]=gold;
	state->hand[0][5]=curse;

	//	Should draw whole deck and only find 1 copper
	state->deck[0][0]=copper;
	state->deck[0][1]=minion;
	state->deck[0][2]=great_hall;
	state->deck[0][3]=adventurer;
	state->deck[0][4]=shanty_town;

	state->numActions = 1;
	// Test 5 - playCard should succeed playing adventurer
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 6 - deckCount should be 0, should have drawn all cards
	if(state->deckCount[0]==0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",0,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 7 - discardCount should be 4, should have discarded 4 cards
	if(state->discardCount[0]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"discardCount[0]",4,state->discardCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 8 - handCount should be 5, should have drawn 1 copper and played card
	if(state->handCount[0]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",5,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 9 - hand[0][4] should be copper for the card that was drawn
	if(state->hand[0][4]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][4]",copper,state->hand[0][4]);
		j++;
	}
	i++;
	ic++;

	// Test 10 - Check if played card is moved to playedCards - playedCardCount == 1
	if(state->playedCardCount==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"playedCardCount",1,state->playedCardCount);
		j++;
	}
	i++;
	ic++;

	// Test 11 - Adventurer should not be in hand
	if(state->hand[0][3] != adventurer)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, hand[0][3] was still adventurer. Should have been moved to playedCards.\n",ic);
		j++;
	}
	i++;
	ic++;

// >> Test Council Room
	printf("-----Testing Council Room-----\n");

	ic=0;

	//	reset deck, discard and hand -- player 1 should still have default deck/hand from above
	state->deckCount[0]=5;
	state->handCount[0]=5;
	state->discardCount[0]=0;

	state->hand[0][0]=estate;
	state->hand[0][1]=copper;
	state->hand[0][2]=council_room;
	state->hand[0][3]=copper;
	state->hand[0][4]=gold;
	state->hand[0][5]=curse;

	state->deck[0][0]=copper;
	state->deck[0][1]=estate;
	state->deck[0][2]=copper;
	state->deck[0][3]=copper;
	state->deck[0][4]=copper;


	state->numActions=1;
	// Test 0 - Test playCard of Council Room
	if(playCard(2, 0, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - numActions should be 0
	if(state->numActions ==0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",0,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Test 2 - handCount for player 0 should be 8
	if(state->handCount[0]==8)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",8,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 3 - deckCount for player 0 should be 1
	if(state->deckCount[0]==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",1,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 4 - handCount for player 1 should be 6
	if(state->handCount[1]==6)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[1]",6,state->handCount[1]);
		j++;
	}
	i++;
	ic++;

	// Test 5 - deckCount for player 1 should be 4
	if(state->deckCount[1]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[1]",4,state->deckCount[1]);

		j++;
	}
	i++;
	ic++;

	// Test 6 - Test hand for player 0 ...will check last card in hand is estate
	if(state->hand[0][7]==estate)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][7]",estate,state->hand[0][7]);
		j++;
	}
	i++;
	ic++;

	// Test 7 - Test hand for player 1 ...should have 6 card as copper
	if(state->hand[1][5]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[1][5]",copper,state->hand[1][5]);
		j++;
	}
	i++;
	ic++;

	// Test 8 - numBuys should be incremented
	if(state->numBuys==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed\n",ic);
		j++;
	}
	i++;
	ic++;

	state->numActions=1;
	state->handCount[0]=5;
	state->deckCount[0]=5;
	state->discardCount[0]=0;
	state->handCount[1]=5;
	state->deckCount[1]=5;
	state->discardCount[1]=0;

	state->hand[0][0]=estate;
	state->hand[0][1]=copper;
	state->hand[0][2]=copper;
	state->hand[0][3]=curse;
	state->hand[0][4]=gold;
	state->hand[0][5]=curse;
	state->hand[1][0]=estate;
	state->hand[1][1]=copper;
	state->hand[1][2]=copper;
	state->hand[1][3]=copper;
	state->hand[1][4]=copper;
	state->hand[1][5]=curse;

	state->deck[0][0]=estate;
	state->deck[0][1]=estate;
	state->deck[0][2]=copper;
	state->deck[0][3]=copper;
	state->deck[0][4]=copper;
	state->deck[1][0]=estate;
	state->deck[1][1]=estate;
	state->deck[1][2]=copper;
	state->deck[1][3]=copper;
	state->deck[1][4]=copper;

	state->deckCount[1]=0;
	state->discardCount[1]=1;
	state->discard[1][0]=silver;
	state->hand[0][2]=council_room;
	// Test 9 - Test playCard of Council Room where player1 has 0 in deck
	if(playCard(2, 0, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 10 - For player 1: Should have shuffled discard into deck and drawn a silver into hand
	if(state->hand[1][5]==silver)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[1][5]",silver,state->hand[1][5]);
		j++;
	}
	i++;
	ic++;

	// Test 11 - player0 should have 8 cards in hand
	if(state->handCount[0]==8)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",8,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

// >> Test Feast
	printf("-----Testing Feast-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=feast;
	state->supplyCount[curse]=5; // cost = 0
	state->supplyCount[treasure_map]=5; // cost = 4
	state->supplyCount[duchy]=5;  // cost = 5
	state->supplyCount[gold]=5; // cost = 6
	state->supplyCount[estate]=0; // cost = 2, should be allowed to buy


	// Test 0 - try to play feast and buy a card costing more than 5
	if(playCard(3, gold, 0, 0, state)==-1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	state->hand[0][3]=feast;
	state->handCount[0]=5;
	state->numActions=1;
	// Test 1 - try to play feast and buy a card not in the game < curse
	if(playCard(3, -1, 0, 0, state)==-1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	state->hand[0][3]=feast;
	state->handCount[0]=5;
	state->numActions=1;
	// Test 2 - try to play feast and buy a card not in the game > treasure_map
	if(playCard(3, treasure_map+1, 0, 0, state)==-1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	state->hand[0][3]=feast;
	state->handCount[0]=5;
	state->numActions=1;
	// Test 3 - try to play feast and buy a card not in the game > treasure_map
	if(playCard(3, treasure_map+1, 0, 0, state)==-1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	state->hand[0][3]=feast;
	state->handCount[0]=5;
	state->numActions=1;
	// Test 4 - try to play feast and buy a card that is sold out...estate
	if(playCard(3, estate, 0, 0, state)==-1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	state->supplyCount[estate]=0;
	state->supplyCount[gardens]=-1;
	state->hand[0][3]=feast;
	state->numActions=1;
	// Test 5 - try to play feast and buy a card that is not in the game...gardens
	if(playCard(3, gardens, 0, 0, state)==-1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	state->hand[0][3]=feast;
	state->handCount[0]=5;
	state->numActions=1;
	// Test 6 - Play feast and buy curse (cost = 0)
	if(playCard(3, curse, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 7 - hand[0][3] should now be curse
	if(state->hand[0][3]==curse)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][3]",curse,state->hand[0][3]);
		j++;
	}
	i++;
	ic++;

	// Test 8 - supply count of curse should be 4
	if(state->supplyCount[curse]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"supplyCount[curse]",4,state->supplyCount[curse]);
		j++;
	}
	i++;
	ic++;

	state->hand[0][3]=feast;
	state->handCount[0]=5;
	state->numActions=1;
	// Test 9 - Play feast and buy treasure_map (cost = 4)
	if(playCard(3, treasure_map, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 10 - hand[0][3] should now be treasure_map
	if(state->hand[0][3]==treasure_map)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][3]",treasure_map,state->hand[0][3]);
		j++;
	}
	i++;
	ic++;

	// Test 11 - supply count of treasure_map should be 4
	if(state->supplyCount[treasure_map]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"supplyCount[treasure_map]",4,state->supplyCount[treasure_map]);
		j++;
	}
	i++;
	ic++;


	state->hand[0][3]=feast;
	state->handCount[0]=5;
	state->numActions=1;
	// Test 12 - Play feast and buy duchy (cost = 5)
	if(playCard(3, duchy, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 13 - hand[0][3] should now be duchy
	if(state->hand[0][3]==duchy)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][3]",duchy,state->hand[0][3]);
		j++;
	}
	i++;
	ic++;

	// Test 14 - supply count of duchy should be 4
	if(state->supplyCount[duchy]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"supplyCount[duchy]",4,state->supplyCount[duchy]);
		j++;
	}
	i++;
	ic++;

// >> Test Festival
	printf("-----Testing Festival-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=festival;

	// Test 0 - test playCard festival
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - Test numBuys
	if(state->numBuys == 2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numBuys",2,state->numBuys);
		j++;
	}
	i++;
	ic++;

	// Test 2 - Test numActions == 2 ...fails because playCard doesn't subtract action for playing card
	if(state->numActions == 2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",2,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Test 3 - additional coins should == 2
	if(state->additionalCoins==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"additionalCoins",2,state->additionalCoins);
		j++;
	}
	i++;
	ic++;

// >> Test Laboratory
	printf("-----Testing Laboratory-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=laboratory;

	// Test 0 - test playCard labratory
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - NumActions should be 1 ** fails because numActions isn't decremented for playing Card
	if( state->numActions==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",1,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Test 2 - deck count should be 3
	if(state->deckCount[0]==3)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",3,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 3 - hand count should be 6 (+2 for draw, -1 for  playedcard)
	if(state->handCount[0]==6)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",6,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

// >> Test Market
	printf("-----Testing Market-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=market;

	// Test 0 - test playCard market
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - NumActions should be 1 ** fails because numActions isn't decremented for playing Card
	if( state->numActions==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",1,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Test 2 - deck count should be 4
	if(state->deckCount[0]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",4,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 3 - hand count should be 5 (+1 for draw, -1 for  playedcard)
	if(state->handCount[0]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed - handCount was %d not 5\n",ic, state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 4 - numBuys should be 2
	if(state->numBuys==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numBuys",2,state->numBuys);
		j++;
	}
	i++;
	ic++;

	// Test 5 - additionalCoins should be 1
	if(state->additionalCoins==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"additionalCoins",1,state->additionalCoins);
		j++;
	}
	i++;
	ic++;


// >> Test Moneylender
	printf("-----Testing Moneylender-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=moneylender;

	state->hand[0][1]=silver;
	state->hand[0][2]=silver;

	// Test 0 - test playCard moneylender
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - handCount should be 4 for played card
	if(state->handCount[0]==4)printf("Test %d -- Passed\n",ic);
	else
	{
				printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",4,state->handCount[0]);
		j++;
	}
	i++;
	ic++;


	// Test 2 - additional coins shoud be 0 -- coins is a check to reveal a bug
	if(state->additionalCoins==0 && state->coins ==0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"additionalCoins",0,state->additionalCoins);
		j++;
	}
	i++;
	ic++;

	resetTestState(state);
	state->hand[0][3]=moneylender;
	state->coins=0;

	// Test 3 - test playCard moneylender
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 4 - handCount should be 3 for played card and copper
	if(state->handCount[0]==3)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",3,state->handCount[0]);
		j++;
	}
	i++;
	ic++;


	// Test 5 - additional coins shoud be 3 ... or case catches coins+3 to show that it is not increment due to return
	if(state->additionalCoins==3 || state->coins==3)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"additionalCoins->coins",3,state->coins);
		j++;
	}
	i++;
	ic++;

	// Test 6 - Hand[0][0] should be estate
	if(state->hand[0][0]==estate)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][0]",estate,state->hand[0][0]);
		j++;
	}
	i++;
	ic++;

	// Test 7 - Hand[0][1] should be copper
	if(state->hand[0][1]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][1]",copper,state->hand[0][1]);
		j++;
	}
	i++;
	ic++;

	// Test 8 - Hand[0][2] should be gold
	if(state->hand[0][2]==gold)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][2]",gold,state->hand[0][2]);
		j++;
	}
	i++;
	ic++;


// >> Test Remodel
	printf("-----Testing Remodel-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=remodel;

	state->supplyCount[estate]=5;


	// Test 0 - test playCard remodel
	if(playCard(3, 1, estate, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - handPos 1 should be an estate
	if(state->hand[0][1]==estate)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][1]",estate,state->hand[0][1]);
		j++;
	}
	i++;
	ic++;

	// Test 2 - supplyCount of estate should be 4
	if(state->supplyCount[estate]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"supplyCount[estate]",4,state->supplyCount[estate]);
		j++;
	}
	i++;
	ic++;

	resetTestState(state);
	state->hand[0][3]=remodel;

	state->supplyCount[estate]=0;


	// Test 3 - test playCard remodel ... empty supply for choice2
	if(playCard(3, 1, estate, 0, state)==-1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	resetTestState(state);
	state->hand[0][3]=remodel;

	// Test 4 - test playCard remodel ... choice2 > treasuremap
	if(playCard(3, 1, treasure_map+1, 0, state)==-1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	resetTestState(state);
	state->hand[0][3]=remodel;


	// Test 5 - test playCard remodel ... choice2 < curse
	if(playCard(3, 1, -1, 0, state)==-1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	resetTestState(state);
	state->hand[0][3]=remodel;

	// Test 6 - test playCard remodel choice1 < 0
	if(playCard(3, -1, estate, 0, state)==-1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	resetTestState(state);
	state->hand[0][3]=remodel;

	// Test 7 - test playCard remodel choice1 = handCount
	if(playCard(3, 5, estate, 0, state)==-1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	resetTestState(state);
	state->hand[0][3]=remodel;

	// Test 8 - test playCard remodel - cost of choice 2 > cost of choice1+2
	if(playCard(3, 1, gold, 0, state)==-1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

// >> Test Smithy
	printf("-----Testing Smithy-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=smithy;

	// Test 0 - test playCard smithy
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - deck should be 2
	if(state->deckCount[0]==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",2,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 2 - hand count should be 7
	if(state->handCount[0]==7)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, handCount was %d\n",ic,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

// >> Test Village
	printf("-----Testing Village-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=village;

	// Test 0 - test playCard village
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - deck should be 4
	if(state->deckCount[0]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",4,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 2 - hand count should be 5
	if(state->handCount[0]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, handCount was %d\n",ic,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 3 - numActions should be 2
	if(state->numActions==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, numActions was %d\n",ic,state->numActions);
		j++;
	}
	i++;
	ic++;

// >> Test Woodcutter
	printf("-----Testing Woodcutter-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=woodcutter;

	// Test 0 - test playCard woodcutter
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - test numBuys == 2
	if(state->numBuys==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numBuys",2,state->numBuys);
		j++;
	}
	i++;
	ic++;

	// Test 2 - test additionalCoins ==2 or coins==2
	if(state->additionalCoins==2 || state->coins==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, additionalCoins/coins.\n",ic);
		j++;
	}
	i++;
	ic++;

// >> Test Baron
	printf("-----Testing Baron-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=baron;

	state->supplyCount[estate]=5;

	// Test 0 - test playCard baron with choice 1 = 0
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - handCount should be 5
	if(state->handCount[0]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, handCount was %d not 5\n",ic,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 2 - hand[0][4] should be an estate
	if(state->hand[0][4]==estate)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][4]",estate,state->hand[0][4]);
		j++;
	}
	i++;
	ic++;

	// Test 3 - supplyCount for estate should be 4
	if(state->supplyCount[estate]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"supplyCount[estate]",4,state->supplyCount[estate]);
		j++;
	}
	i++;
	ic++;

	// Test 4 - numBuys should be 2
	if(state->numBuys == 2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numBuys",2,state->numBuys);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=baron;

	state->supplyCount[estate]=0;

	// Test 5 - test playCard baron with choice1=0 when there are no estates in the supply, should fail
	if(playCard(3, 0, 0, 0, state)==-1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=baron;

	state->supplyCount[estate]=0;

	// Test 6 - test playCard baron with choice1=1 and no estates in supply, should pass
	if(playCard(3, 1, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 7 - discardCount should be 1
	if(state->discardCount[0]==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"discardCount[0]",1,state->discardCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 8 - discard[0][0] should be estate
	if(state->discard[0][0]==estate)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"discard[0][0]",estate,state->discard[0][0]);
		j++;
	}
	i++;
	ic++;

	// Test 9 - handCount should be 3, -1 for played card, -1 for discarded card
	if(state->handCount[0] ==3)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",3,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 10 - hand[0][0] should be copper
	if(state->hand[0][0]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][0]",copper,state->hand[0][0]);
		j++;
	}
	i++;
	ic++;

	// Test 11 - hand[0][2] should not be copper, whether or not played card is discarded (tests the shift worked properly)
	if(state->hand[0][2] != copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting not %d but was %d\n",ic,"hand[0][2]",copper,state->hand[0][2]);
		j++;
	}
	i++;
	ic++;

	// Test 12 - numBuys should be 2
	if(state->numBuys == 2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numBuys",2,state->numBuys);
		j++;
	}
	i++;
	ic++;

	// Test 13 - test additionalCoins is 4, or coins==4
	if(state->additionalCoins==4 || state->coins==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, additionalCoins/coins.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=baron;

	// Test 14 - test playCard baron with choice1=2 ... should fail, return -1
	if(playCard(3, 2, 0, 0, state)==-1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;


// >> Test Bridge
	printf("-----Testing Bridge-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=bridge;

	// Test 0 - test playCard bridge
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - numBuys should be 2
	if(state->numBuys == 2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numBuys",2,state->numBuys);
		j++;
	}
	i++;
	ic++;

	// Test 2 - additionalCoins should == 1 or coins ==1
	if(state->additionalCoins==1 || state->coins==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, additonalCoins/coins.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 3 - costDiff should be 1 || -1 depending on if you add or subtract costDiff in by card
	if(state->costDiff==1 || state->costDiff==-1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, costDiff\n",ic);
		j++;
	}
	i++;
	ic++;


// >> Test Coppersmith
	printf("-----Testing Coppersmith-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=coppersmith;

	// Test 0 - test playCard coppersmith
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - copperBonus should be 1
	if(state->copperBonus==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, copperBonus.\n",ic);
		j++;
	}
	i++;
	ic++;


	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=coppersmith;
	state->hand[0][1]=silver;
	state->hand[0][2]=silver;

	// Test 2 - test playCard coppersmith
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed, playedCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playedCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 3 - copperBonus should be 0
	if(state->copperBonus==0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, copperBonus.\n",ic);
		j++;
	}
	i++;
	ic++;

// >> Test Great Hall
	printf("-----Testing Great Hall-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=great_hall;

	// Test 0 - test playCard great_hall
	if(playCard(3, 0, 0, 0, state)==0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - numActions should be 1, -1 for playing card, +1 for great_hall
	if(state->numActions == 1 )printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",1,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Test 2 - handCount should be 5, -1 for played card, +1 for +1card
	if(state->handCount[0]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",5,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

// >> Test Minion
	printf("-----Testing Minion-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=minion;

	// Test 0 - test playCard minion - choice 1 = 0
	if(playCard(3, 0, 0, 0, state)== -1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - test playCard minion - choice 1 = 3
	if(playCard(3, 3, 0, 0, state)== -1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=minion;

	// Test 2 - test playCard minion choice 1 = 1
	if(playCard(3, 1, 0, 0, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 3 - numActions should be 1 (-1 for playing card, +1 for Minion)
	if(state->numActions==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",1,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Test 4 - additionalCoins or coins should be 2, depending on how you keep track
	if(state->additionalCoins==2 || state->coins==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, additionalCoins/coins.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=minion;

	// Test 5 - test playCard minion choice 1 = 2
	if(playCard(3, 2, 0, 0, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 6 -	handCount for player 0 = 4
	if(state->handCount[0]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, handCount[0] was %d, expected 4.\n",ic,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 7 - handCount for player 1 = 4
	if(state->handCount[1]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, handCount[1] was %d, expected 4.\n",ic, state->handCount[1]);
		j++;
	}
	i++;
	ic++;

	// Test 8 - discardCount for player 0 = 5
	if(state->discardCount[0]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"discardCount[0]",5,state->discardCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 9 - discardCount for player 1 = 5
	if(state->discardCount[1]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"discardCount[1]",5,state->discardCount[1]);
		j++;
	}
	i++;
	ic++;

	// Test 10 - deckCount for player 0 = 1
	if(state->deckCount[0]==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",1,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 11 - deckCount for player 1 = 1
	if(state->deckCount[1]==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[1]",1,state->deckCount[1]);
		j++;
	}
	i++;
	ic++;

	// Test 12 - hand[0][0] should be copper
	if(state->hand[0][0]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][0]",copper,state->hand[0][0]);
		j++;
	}
	i++;
	ic++;

	// Test 13 - hand[0][3] should be estate
	if(state->hand[0][3]==estate)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][3]",estate,state->hand[0][3]);
		j++;
	}
	i++;
	ic++;

	// Test 14 - hand[1][0] should be copper
	if(state->hand[1][0]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[1][0]",copper,state->hand[1][0]);
		j++;
	}
	i++;
	ic++;

	// Test 15 - hand[1][4] should be estate
	if(state->hand[1][3]==estate)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[1][3]",estate,state->hand[1][3]);
		j++;
	}
	i++;
	ic++;

// >> Test Pawn
	printf("-----Testing Pawn-----\n");

	ic=0;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=pawn;

	// Test 0 - test playCard pawn - choice 1 = 0 choice 2 = 5
	if(playCard(3, 0, 5, 0, state)== -1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=pawn;

	// Test 1 - test playCard pawn - valid choice 1 and choice 2 = 0
	if(playCard(3, 4, 0, 0, state)== -1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=pawn;

	// Test 2 - test playCard pawn - choice 1 = 0 and valid choice 2
	if(playCard(3, 0, 4, 0, state)== -1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=pawn;

	// Test 3 - test playCard pawn - choice 1 == choice 2
	if(playCard(3, 1, 1, 0, state)== -1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=pawn;

	// Test 4 - test playCard pawn - choice 1 = 1 and choice 2 = 2
	if(playCard(3, 1, 2, 0, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Tests for choice 1 -- +1card

	// Test 5 - +1 for +1Card, -1 for played card, =5
	if(state->handCount[0]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",5,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 6 - DeckCount == 4
	if(state->deckCount[0]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",4,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;

	// Tests for choice 2 -- +1 action

	// Test 7 - numActions should be 1
	if(state->numActions == 1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numAction",1,state->numActions);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=pawn;

	// Test 8 - test playCard pawn - choice 1 = 2 and choice 2 = 3
	if(playCard(3, 2, 3, 0, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;


	// Tests for choice 2 -- +1 action

	// Test 9 - numActions should be 1
	if(state->numActions == 1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numAction",1,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Tests for choice 3 -- +1buy

	// Test 10 - numBuys == 2
	if(state->numBuys==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numBuys",2,state->numBuys);
		j++;
	}
	i++;
	ic++;


	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=pawn;

	// Test 11 - test playCard pawn - choice 1 = 3 and choice 2 = 4
	if(playCard(3, 3, 4, 0, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;


	// Tests for choice 3 -- +1buy

	// Test 12 - numBuys == 2
	if(state->numBuys==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numBuys",2,state->numBuys);
		j++;
	}
	i++;
	ic++;

	// Tests for choice 4 -- +1coin

	// Test 13 - coins or additionalCoins should be 1
	if(state->coins == 1 || state->additionalCoins==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, additionalCoins/Coins.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=pawn;

	// Test 14 - test playCard pawn - choice 1 = 4 and choice 2 = 1
	if(playCard(3, 4, 1, 0, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Tests for choice 4 -- +1coin

	// Test 15 - coins or additionalCoins should be 1
	if(state->coins == 1 || state->additionalCoins==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, additionalCoins/coins.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Tests for choice 1 -- +1card

	// Test 16 - +1 for +1Card, -1 for played card, =5
	if(state->handCount[0]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",5,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 17 - DeckCount == 4
	if(state->deckCount[0]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",4,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;


// >> ShantyTown
	printf("-----Testing ShantyTown-----\n");

	ic=0;
	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=shanty_town;

	// Test 0 - test playCard ShantyTown - no action cards
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - +2 actions, numActions should be 2
	if(state->numActions==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",2,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Test 2 - should have drawn two cards, deckCount should be 3
	if(state->deckCount[0]==3)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed,deckCount was %d\n",ic,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;


	// Test 3 - handCount should be 6, +2 for draw and -1 for played
	if(state->handCount[0]==6)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",6,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=shanty_town;
	state->hand[0][4]=adventurer;

	// Test 4 - test playCard ShantyTown - finds action cards
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 5 - +2 actions, numActions should be 2
	if(state->numActions==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",2,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Test 6 - shouldn't have drawn any cards
	if(state->deckCount[0]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",5,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=shanty_town;
	state->hand[0][0]=duchy;

	// Test 7 - test playCard ShantyTown - no action cards
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 8 - +2 actions, numActions should be 2
	if(state->numActions==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",2,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Test 9 - should have drawn two cards, deckCount should be 3
	if(state->deckCount[0]==3)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed,deckCount was %d\n",ic,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;


	// Test 10 - handCount should be 6, +2 for draw and -1 for played
	if(state->handCount[0]==6)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",6,state->handCount[0]);
		j++;
	}
	i++;
	ic++;


	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=shanty_town;
	state->hand[0][0]=treasure_map;

	// Test 11 - test playCard ShantyTown - finds action cards
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 12 - +2 actions, numActions should be 2
	if(state->numActions==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",2,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Test 13 - shouldn't have drawn any cards
	if(state->deckCount[0]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",5,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;



// >> Steward
	printf("-----Testing Steward-----\n");

	ic=0;
	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=steward;

	// Test 0 - test playCard Steward - choice out of bounds
	if(playCard(3, 0, 0, 0, state)== -1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=steward;

	// Test 1 - test playCard Steward - choice out of bounds
	if(playCard(3, 4, 0, 0, state)== -1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=steward;

	// Test 2 - test playCard Steward - choice 1, plus 2 cards
	if(playCard(3, 1, 0, 0, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 3 - deckCount should be 3
	if(state->deckCount[0]==3)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",3,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;


	// Test 4 - handCount should be 6
	if(state->handCount[0]==6)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",6,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=steward;

	// Test 5 - test playCard Steward - choice 2, plus 2 coins
	if(playCard(3, 2, 0, 0, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;


	// Test 6 - coins or additional coins should be 2
	if(state->coins == 2 || state->additionalCoins==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, coins/additionalCoins.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][4]=steward;

	// Test 7 - test playCard Steward - choice 3 trash 2 cards with 5 cards in hand
	if(playCard(4, 3, 0, 1, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 8 - Should have trashed 0 and 1, hand [0] should be copper
	if(state->hand[0][0]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][0]",copper,state->hand[0][0]);
		j++;
	}
	i++;
	ic++;

	// Test 9 - hand [1] should be curse
	if(state->hand[0][1]==curse)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][1]",curse,state->hand[0][1]);
		j++;
	}
	i++;
	ic++;

	// Test 10 - handCount should be 2
	if(state->handCount[0]==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",2,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][4]=steward;

	// Test 11 - test playCard Steward - choice 3 trash 2 cards with 5 cards in hand, choice 2 > choice 3
	if(playCard(4, 3, 1, 0, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 12 - Should have trashed 0 and 1, hand [0] should be copper
	if(state->hand[0][0]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][0]",copper,state->hand[0][0]);
		j++;
	}
	i++;
	ic++;

	// Test 13 - hand [1] should be curse
	if(state->hand[0][1]==curse)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][1]",curse,state->hand[0][1]);
		j++;
	}
	i++;
	ic++;

	// Test 14 - handCount should be 2
	if(state->handCount[0]==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",2,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][2]=steward;
	state->handCount[0]=3;

	// Test 15 - test playCard Steward - choice 3 trash 2 cards with 3 cards in hand
	if(playCard(2, 3, 0, 1, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 16 - hand should be empty
	if(state->handCount[0]==0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, handCount was %d\n",ic,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][1]=steward;
	state->handCount[0]=2;

	// Test 17 - test playCard Steward - choice 3 trash 2 cards with 2 cards in hand
	if(playCard(1, 3, 0, 1, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 18 - handCount should be 0, should have only removed card 1
	if(state->handCount[0]==0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",0,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 19 - playedCard[0] should be steward
	if(state->playedCards[0]==steward)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"playedCards[0]",steward,state->playedCards[0]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][0]=steward;
	state->handCount[0]=1;

	// Test 20 - test playCard Steward - no cards to trash
	if(playCard(0, 3, 0, 1, state)== -1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=steward;
	state->handCount[0]=5;

	// Test 21 - test playCard Steward - choice1==3 and choice 2 == choice 3
	if(playCard(3, 3, 1, 1, state)== -1)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;



	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][4]=steward;
	state->handCount[0]=5;

	// Test 22 - test playCard Steward - choice1==3 and choice 2 > choice 3
	if(playCard(4, 3, 2, 1, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 23 - should have trashed both copper, hand[0][0] should be estate
	if(state->hand[0][0]==estate)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][0]",estate,state->hand[0][0]);
		j++;
	}
	i++;
	ic++;

	// Test 24 - should have trashed both copper, hand[0][1] should be curse
	if(state->hand[0][1]==curse)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][1]",copper,state->hand[0][1]);
		j++;
	}
	i++;
	ic++;

// >> Tribute
	printf("-----Testing Tribute-----\n");

	ic=0;
	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=tribute;

	// Test 0 - test playCard Tribute for player 0, should succeed
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed, playCard.\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[1][3]=tribute;
	state->whoseTurn = 1;
	state->deck[0][3]=adventurer;

	// Test 1 - test playCard Tribute for player 1, player 0 deck is action and treasure
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 2 - test action, +2 actions
	if(state->numActions==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",2,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Test 3 - test treasure +2coins
	if(state->coins == 2 || state->additionalCoins ==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, additionalCoins/coins.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[1][3]=tribute;
	state->whoseTurn = 1;
	state->deck[0][3]=gold;
	state->deck[0][4]=treasure_map;

	// Test 4 - test playCard Tribute for player 1, player 0 deck is treasure and action (reversed)
	if(playCard(3, 0, 0, 0, state) ==0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 5 - test action, +2 actions
	if(state->numActions==2)printf("Test %d -- Passed\n",ic);
	else
	{
			printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",2,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Test 6 - test treasure +2coins
	if(state->coins == 2 || state->additionalCoins ==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, coins/additionalCoins.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[1][3]=tribute;
	state->whoseTurn = 1;
	state->deck[0][3]=estate;

	// Test 7 - test playCard Tribute for player 1, player 0 deck is victory and treasure
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed\n",ic);
		j++;
	}
	i++;
	ic++;


	// Test 8 - test treasure +2coins
	if(state->coins == 2 || state->additionalCoins ==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, coins/additionalCoins.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 9 - test victory +2cards -- deckCount == 3
	if(state->deckCount[1]==3)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[1]",3,state->deckCount[1]);
		j++;
	}
	i++;
	ic++;

	// Test 10 - test victory -- handCount == 6 (+2 -1)
	if(state->handCount[1]==6)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[1]",6,state->handCount[1]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[1][3]=tribute;
	state->whoseTurn = 1;
	state->deck[0][4]=duke;

	// Test 11 - test playCard Tribute for player 1, player 0 deck is victory (duke) and treasure
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed\n",ic);
		j++;
	}
	i++;
	ic++;


	// Test 12 - test treasure +2coins
	if(state->coins == 2 || state->additionalCoins ==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, coins/additionalCoins.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 13 - test victory +2cards -- deckCount == 3
	if(state->deckCount[1]==3)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[1]",3,state->deckCount[1]);
		j++;
	}
	i++;
	ic++;

	// Test 14 - test victory -- handCount == 6 (+2 -1)
	if(state->handCount[1]==6)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[1]",6,state->handCount[1]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[1][3]=tribute;
	state->whoseTurn = 1;
	state->deck[0][3]=curse;

	// Test 15 - test playCard Tribute for player 1, player 0 deck is treasure and curse
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;


	// Test 16 - test treasure +2coins
	if(state->coins == 2 || state->additionalCoins ==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, coins/additionalCoins.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 17 - test not victory -- deckCount == 5
	if(state->deckCount[1]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[1]",5,state->deckCount[1]);
		j++;
	}
	i++;
	ic++;

	// Test 18 - test not action -- numActions == 0
	if(state->numActions==0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",0,state->numActions);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[1][3]=tribute;
	state->whoseTurn = 1;

	// Test 19 - test playCard Tribute for player 1, player 0 deck is two treasure, should only count one
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;


	// Test 20 - test treasure +2coins
	if(state->coins == 2 || state->additionalCoins ==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, coins/additionalCoins.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[1][3]=tribute;
	state->whoseTurn = 1;
	state->deck[0][3]=treasure_map+1;

	// Test 21 - test playCard Tribute for player 1, player 0 deck is treasure and an invalid card >treasuremap
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;


	// Test 22 - test treasure +2coins
	if(state->coins == 2 || state->additionalCoins ==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, coins/additionalCoins\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 23 - test not victory -- deckCount == 5
	if(state->deckCount[1]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[1]",5,state->deckCount[1]);
		j++;
	}
	i++;
	ic++;

	// Test 24 - test not action -- numActions == 0
	if(state->numActions==0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, numActions was %d (should be 0)\n",ic, state->numActions);
		j++;
	}
	i++;
	ic++;

// >> Wishing Well
	printf("-----Testing Wishing Well-----\n");

	ic=0;
	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=wishing_well;
	state->deck[0][3]=adventurer;

	// Test 0 - Test playCard Wishing Well guessing copper
	if(playCard(3, copper, 0, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;


	// Test 1 - Test numActions == 1
	if(state->numActions==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",1,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Test 2 - Should have drawn 1 card because didn't match
	if(state->deckCount[0]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, deck was %d (should have been 4)\n",ic,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=wishing_well;
	state->deck[0][3]=adventurer;

	// Test 3 - Test playCard Wishing Well guessing correctly adventurer
	if(playCard(3, adventurer, 0, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;


	// Test 4 - Test numActions == 1
	if(state->numActions==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numActions",1,state->numActions);
		j++;
	}
	i++;
	ic++;

	// Test 5 - Should have drawn 1 card because didn't match
	if(state->deckCount[0]==3)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, deck was %d (should have been 3)\n",ic,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;


// >> Ambassador
	printf("-----Testing Ambassador-----\n");

	ic=0;
	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=ambassador;
	state->supplyCount[copper]=5;

	// Test 0 - Test playCard ambassador, looking for copper
	if(playCard(3, 1, 2, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - supplyCount of copper should be 6...+2 from player 0, -1 from player 1
	if(state->supplyCount[copper]==6)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, supply count was %d (should have been 6)\n",ic,state->supplyCount[copper]);
		j++;
	}
	i++;
	ic++;

	// Test 2 - handCount of player 0 = 2
	if(state->handCount[0]==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",2,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 3 - hand[0][1] == gold
	if(state->hand[0][1]==gold)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, hand[0][1] was %d (should have been %d)\n",ic,state->hand[0][1],gold);
		j++;
	}
	i++;
	ic++;

	// Test 4 - handCount[1] == 6
	if(state->handCount[1]==6)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, should have been 6 but handCount[1] was %d\n",ic,state->handCount[1]);
		j++;
	}
	i++;
	ic++;

	// Test 5 - hand[1][5]==copper
	if(state->hand[1][5]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, hand[1][5]==%d but was %d\n",ic,copper,state->hand[1][5]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=ambassador;
	state->hand[0][4]=copper;
	state->supplyCount[copper]=5;

	// Test 6 - Test playCard ambassador only puts 2 back
	if(playCard(3, 1, 3, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed playing card.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 7 - supply count should be 6
	if(state->supplyCount[copper]==6)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, supplyCount[copper] should have been 6 but was %d\n",ic,state->supplyCount[copper]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=ambassador;
	state->supplyCount[copper]=5;

	// Test 8 - Test playCard ambassador shouldn't accept choice1 if not a card
	if(playCard(3, -1, 3, 0, state)== -1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=ambassador;
	state->supplyCount[copper]=5;

	// Test 9 - Test playCard ambassador shouldn't accept choice1 if not a card
	if(playCard(3, 5, 3, 0, state)== -1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed error checking. Allowed choice1 as an invalid hand position.\n",ic);
		j++;
	}
	i++;
	ic++;

// >> Cutpurse
	printf("-----Testing Cutpurse-----\n");

	ic=0;
	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=cutpurse;
	state->hand[1][3]=curse;

	// Test 0 - Test playCard cutpurse
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - coins or additionalCoins should be +2
	if(state->additionalCoins==2 || state->coins==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, additionalCoins/coins.\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 2 - handCount of player 1 should be 4
	if(state->handCount[1]==4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[1]",4,state->handCount[1]);
		j++;
	}
	i++;
	ic++;

	// Test 3 - hand[1][2]==curse
	if(state->hand[1][2]==curse)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[1][2]",curse,state->hand[1][2]);
		j++;
	}
	i++;
	ic++;

	// Test 4 - hand[1][3]==copper
	if(state->hand[1][3]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[1][3]",copper,state->hand[1][3]);
		j++;
	}
	i++;
	ic++;

	// Test 5 - discardCount for player 1 == 1
	if(state->discardCount[1]==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"discardCount[1]",1,state->discardCount[1]);
		j++;
	}
	i++;
	ic++;

	// Test 6 - discard[1][0] should be copper
	if(state->discard[1][0]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"discard[1][0]",copper,state->discard[1][0]);
		j++;
	}
	i++;
	ic++;



// >> Salvager
	printf("-----Testing Salvager-----\n");

	ic=0;
	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=salvager;

	// Test 0 - Test playCard Salvager
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - +1 buy
	if(state->numBuys == 2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"numBuys",2,state->numBuys);
		j++;
	}
	i++;
	ic++;

	// Test 2 - coins or additionalCoins should be cost of estate (2)
	if(state->coins ==2 || state->additionalCoins==2)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, coins was %d\n",ic,state->coins);
		j++;
	}
	i++;
	ic++;

	// Test 3 - handCount should be 3
	if(state->handCount[0]==3)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",3,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 4 - hand[0][0] should be copper
	if(state->hand[0][0]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
			printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][0]",copper,state->hand[0][0]);
		j++;
	}
	i++;
	ic++;

	// Test 5 - hand[0][1] should be copper
	if(state->hand[0][1]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][1]",copper,state->hand[0][1]);
		j++;
	}
	i++;
	ic++;

	// Test 6 - hand[0][2] != copper
	if(state->hand[0][2] != copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting not %d but was %d\n",ic,"hand[0][2]",copper,state->hand[0][2]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=salvager;

	// Test 7 - choice 1 < hand should fail
	if(playCard(3, -1, 0, 0, state)== -1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=salvager;

	// Test 8 - choice 1 > handCount should fail
	if(playCard(3, 5, 0, 0, state)== -1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, playCard.\n",ic);
		j++;
	}
	i++;
	ic++;

// >> Sea Hag
	printf("-----Testing Sea Hag-----\n");

	ic=0;
	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=sea_hag;
	state->supplyCount[curse]=5;

	// Test 0 - Test playCard Sea Hag
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - Discard Count for player 1 should be 1
	if(state->discardCount[1]==1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"discardCount[1]",1,state->discardCount[1]);
		j++;
	}
	i++;
	ic++;

	// Test 2 - Deck Count should still be 5
	if(state->deckCount[1]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[1]",5,state->deckCount[1]);
		j++;
	}
	i++;
	ic++;

	// Test 3 - top of discard should be old top of deck (copper)
	if(state->discard[1][0]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"discard[1][0]",copper,state->discard[1][0]);
		j++;
	}
	i++;
	ic++;

	// Test 4 - top of deck should be curse
	if(state->deck[1][4]==curse)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deck[1][4]",curse,state->deck[1][4]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=sea_hag;
	state->supplyCount[curse]=0;

	// Test 5 - Test playCard Sea Hag
	if(playCard(3, 0, 0, 0, state)== -1)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed\n",ic);
		j++;
	}
	i++;
	ic++;


// >> Treasure Map
	printf("-----Testing Treasure Map-----\n");

	ic=0;
	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=treasure_map;

	// Test 0 - Test playCard treasure map - 1 treasuremap
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 1 - hand count should be 4
	if(state->handCount[0] == 4)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",4,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 2 - hand[0][3] should be gold
	if(state->hand[0][3]==gold)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][3]",gold,state->hand[0][3]);
		j++;
	}
	i++;
	ic++;

	// Test 3 - deckCount should be 5
	if(state->deckCount[0]==5)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",5,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;

	//	reset deck, discard and hand
	resetTestState(state);
	state->hand[0][3]=treasure_map;
	state->hand[0][1]=treasure_map;
	state->supplyCount[gold]=5;

	// Test 4 - Test playCard treasure map - 2 treasuremaps
	if(playCard(3, 0, 0, 0, state)== 0)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed\n",ic);
		j++;
	}
	i++;
	ic++;

	// Test 5 - handCount should be 3
	if(state->handCount[0]==3)printf("Test %d -- Passed\n",ic);
	else
	{
			printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"handCount[0]",3,state->handCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 6 - hand[0][1] == copper
	if(state->hand[0][1]==copper)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][1]",copper,state->hand[0][1]);
		j++;
	}
	i++;
	ic++;

	// Test 7 - hand[0][2] == gold
	if(state->hand[0][2]==gold)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"hand[0][2]",gold,state->hand[0][2]);
		j++;
	}
	i++;
	ic++;

	// Test 8 - deckCount should be 9
	if(state->deckCount[0]==9)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deckCount[0]",9,state->deckCount[0]);
		j++;
	}
	i++;
	ic++;

	// Test 9 - deck[0][5] == gold
	if(state->deck[0][5]==gold)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deck[0][5]",gold,state->deck[0][5]);
		j++;
	}
	i++;
	ic++;

	// Test 10 - deck[0][6] == gold
	if(state->deck[0][6]==gold)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deck[0][6]",gold,state->deck[0][6]);
		j++;
	}
	i++;
	ic++;

	// Test 11 - deck[0][7] == gold
	if(state->deck[0][7]==gold)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deck[0][7]",gold,state->deck[0][7]);
		j++;
	}
	i++;
	ic++;

	// Test 12 - deck[0][8] == gold
	if(state->deck[0][8]==gold)printf("Test %d -- Passed\n",ic);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",ic,"deck[0][8]",gold,state->deck[0][8]);
		j++;
	}
	i++;
	ic++;

	free(state);
	printf("Finished Testing Play Card.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testDiscardToDeck(){
	int i, j, cop, sil, gol, est, prov,k;
	i = j = 0;
	cop = sil = gol = est = prov = 0;
	printf("-----------\nTest Discard To Deck:\n");
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));

	state->whoseTurn=0;
	state->deckCount[0]=0;
	state->discardCount[0]=5;
	state->discard[0][0]=copper;
	state->discard[0][1]=silver;
	state->discard[0][2]=gold;
	state->discard[0][3]=estate;
	state->discard[0][4]=province;

	// Test 0 - Try to shuffle the discard into the deck
	if(discardToDeck(state)==0)printf("Test %d -- Passed, discardToDeck.\n",i);
	else
	{
		printf("Test %d -- Failed, discardToDeck.\n",i);
		j++;
	}
	i++;


	// Test 1 - confirm that deck now contains 5 cards
	if(state->deckCount[0]==5)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"deckCount[0]",5,state->deckCount[0]);
		j++;
	}
	i++;

	// Test 2- confirm that discard is now empty
	if(state->discardCount[0]==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"discardCount[0]",0,state->discardCount[0]);
		j++;
	}
	i++;

	for(k=0;k<5;k++)
	{
		if(state->deck[0][k]==copper) cop += 1;
		else if(state->deck[0][k]==silver) sil +=1;
		else if (state->deck[0][k]==gold) gol +=1;
		else if (state->deck[0][k]==estate) est +=1;
		else if (state->deck[0][k]==province) prov +=1;
	}

	// Test 3 - confirm there was 1 copper in deck
	if(cop == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"# of copper in the deck",1,cop);
		j++;
	}
	i++;

	// Test 4 - confirm there was 1 silver in deck
	if(sil == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"# of silver in the deck",1,sil);
		j++;
	}
	i++;

	// Test 5 - confirm there was 1 gold in deck
	if(gol == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"# of gold in the deck",1,gol);
		j++;
	}
	i++;

	// Test 6 - confirm there was 1 estate in deck
	if(est == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"# of estates in the deck",1,est);
		j++;
	}
	i++;

	// Test 7 - confirm there was 1 province in deck
	if(prov == 1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"# of province in the deck",1,prov);
		j++;
	}
	i++;


	state->deckCount[0]=2;
	state->discardCount[0]=5;

	// Test 8 - discardToDeck should fail if deck is not empty(?)
	if(discardToDeck(state)==-1)printf("Test %d -- Passed, discardToDeck.\n",i);
	else
	{
		printf("Test %d -- Failed, discardToDeck.\n",i);
		j++;
	}
	i++;

	// Ask if discard is empty if discardToDeck should return -1...right test case if so

	free(state);
	printf("Finished Testing Discard To Deck.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testDeckToHand(){
	int i, j,k;
	i = j = 0;
	printf("-----------\nTest Deck To Hand:\n");
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));

	state->whoseTurn=0;
	state->deckCount[0]=10;
	state->handCount[0]=0;

	for(k=0;k<10;k++)
		state->deck[0][k]=k;

	// initialize hand to 99
	for(k=0;k<12;k++)
		state->hand[0][k]=99;


	// Test 0 - Draw 1
	if(deckToHand(1,state)==0)printf("Test %d -- Passed, deckToHand.\n",i);
	else
	{
		printf("Test %d -- Failed, deckToHand.\n",i);
		j++;
	}
	i++;

	// Test 1 - DeckCount should be 9
	if(state->deckCount[0]==9)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"deckCount[0]",9,state->deckCount[0]);
		j++;
	}
	i++;

	// Test 2 - HandCount should be 1
	if(state->handCount[0]==1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"handCount[0]",1,state->handCount[0]);
		j++;
	}
	i++;

	// Test 3 - Hand[0][0] should be 9
	if(state->hand[0][0]==9)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][0]",9,state->hand[0][0]);
		j++;
	}
	i++;

	// Test 4 - Test draw 5
	if(deckToHand(5, state)==0)printf("Test %d -- Passed, deckToHand.\n",i);
	else
	{
		printf("Test %d -- Failed, deckToHand.\n",i);
		j++;
	}
	i++;

	// Test 5 - Hand[0][0] should still be 9
	if(state->hand[0][0]==9)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][0]",9,state->hand[0][0]);
		j++;
	}
	i++;

	// Test 6 - Hand[0][1] should be 8
	if(state->hand[0][1]==8)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][1]",8,state->hand[0][1]);
		j++;
	}
	i++;

	// Test 7 - Hand[0][2] should be 7
	if(state->hand[0][2]==7)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][2]",7,state->hand[0][2]);
		j++;
	}
	i++;

	// Test 8 - Hand[0][3] should be 6
	if(state->hand[0][3]==6)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][3]",6,state->hand[0][3]);
		j++;
	}
	i++;

	// Test 9 - Hand[0][4] should be 5
	if(state->hand[0][4]==5)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][4]",5,state->hand[0][4]);
		j++;
	}
	i++;

	// Test 10 - Hand[0][5] should be 4
	if(state->hand[0][5]==4)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][5]",4,state->hand[0][5]);
		j++;
	}
	i++;

	// Test 11 - handCount should be 6
	if(state->handCount[0]==6)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"handCount[0]",6,state->handCount[0]);
		j++;
	}
	i++;

	// Test 12 - deckCount should be 4
	if(state->deckCount[0]==4)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"deckCount[0]",4,state->deckCount[0]);
		j++;
	}
	i++;

	state->discard[0][0]=0;
	state->discardCount[0]=1;

	// Test 13 - deckToHand when there aren't enough cards in deck
	if(deckToHand(5,state)==0)printf("Test %d -- Passed, deckToHand.\n",i);
	else
	{
		printf("Test %d -- Failed, deckToHand.\n",i);
		j++;
	}
	i++;

	// Test 14 - discardCount should be 0
	if( state->discardCount[0]==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"discardCount[0]",0,state->discardCount[0]);
		j++;
	}
	i++;

	// Test 15 	- deckCount should be 0
	if(state->deckCount[0]==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"deckCount[0]",0,state->deckCount[0]);
		j++;
	}
	i++;

	// Test 16 - handCount should be 11
	if(state->handCount[0]==11)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"handCount[0]",11,state->handCount[0]);
		j++;
	}
	i++;

	// Test 17 - hand[0][10] should be 0
	if(state->hand[0][10]==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][10]",0,state->hand[0][10]);
		j++;
	}
	i++;

	// Test 18 - hand[0][9] should be 0
	if(state->hand[0][9]==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][9]",0,state->hand[0][9]);
		j++;
	}
	i++;

	// Test 19 - hand[0][8] should be 1
	if(state->hand[0][8]==1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][8]",1,state->hand[0][8]);
		j++;
	}
	i++;

	// Test 20 - hand[0][7] should be 2
	if(state->hand[0][7]==2)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][7]",2,state->hand[0][7]);
		j++;
	}
	i++;

	// Test 21 - hand[0][6] should be 3
	if(state->hand[0][6]==3)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][6]",3,state->hand[0][6]);
		j++;
	}
	i++;

	// Test 22 - hand[0][5] should be still be 4
	if(state->hand[0][5]==4)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][5]",4,state->hand[0][5]);
		j++;
	}
	i++;

	free(state);
	printf("Finished Testing Deck To Hand.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

int testDeckToHand2(){
	int i, j,k;
	i = j = 0;
	printf("-----------\nTest Deck To Hand 2:\n");
	struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));

	state->whoseTurn=1;
	state->deckCount[0]=10;
	state->handCount[0]=0;

	for(k=0;k<10;k++)
		state->deck[0][k]=k;

	// initialize hand to 99
	for(k=0;k<12;k++)
		state->hand[0][k]=99;

	// Test 0 - Draw 1
	if(deckToHand2(1,state,0)==0)printf("Test %d -- Passed, deckToHand2.\n",i);
	else
	{
		printf("Test %d -- Failed, deckToHand2.\n",i);
		j++;
	}
	i++;

	// Test 1 - DeckCount should be 9
	if(state->deckCount[0]==9)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"deckCount[0]",9,state->deckCount[0]);
		j++;
	}
	i++;

	// Test 2 - HandCount should be 1
	if(state->handCount[0]==1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"handCount[0]",1,state->handCount[0]);
		j++;
	}
	i++;

	// Test 3 - Hand[0][0] should be 9
	if(state->hand[0][0]==9)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][0]",9,state->hand[0][0]);
		j++;
	}
	i++;

	// Test 4 - Test draw 5
	if(deckToHand2(5, state,0)==0)printf("Test %d -- Passed, deckToHand2.\n",i);
	else
	{
		printf("Test %d -- Failed, deckToHand2.\n",i);
		j++;
	}
	i++;

	// Test 5 - Hand[0][0] should still be 9
	if(state->hand[0][0]==9)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][0]",9,state->hand[0][0]);
		j++;
	}
	i++;

	// Test 6 - Hand[0][1] should be 8
	if(state->hand[0][1]==8)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][1]",8,state->hand[0][1]);
		j++;
	}
	i++;

	// Test 7 - Hand[0][2] should be 7
	if(state->hand[0][2]==7)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][2]",7,state->hand[0][2]);
		j++;
	}
	i++;

	// Test 8 - Hand[0][3] should be 6
	if(state->hand[0][3]==6)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][3]",6,state->hand[0][3]);
		j++;
	}
	i++;

	// Test 9 - Hand[0][4] should be 5
	if(state->hand[0][4]==5)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][4]",5,state->hand[0][4]);
		j++;
	}
	i++;

	// Test 10 - Hand[0][5] should be 4
	if(state->hand[0][5]==4)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][5]",4,state->hand[0][5]);
		j++;
	}
	i++;

	// Test 11 - handCount should be 6
	if(state->handCount[0]==6)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"handCount[0]",6,state->handCount[0]);
		j++;
	}
	i++;

	// Test 12 - deckCount should be 4
	if(state->deckCount[0]==4)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"deckCount[0]",4,state->deckCount[0]);
		j++;
	}
	i++;

	state->discard[0][0]=0;
	state->discardCount[0]=1;

	// Test 13 - deckToHand when there aren't enough cards in deck
	if(deckToHand2(5,state,0)==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed\n",i);
		j++;
	}
	i++;

	// Test 14 - discardCount should be 0
	if( state->discardCount[0]==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"discardCount[0]",0,state->discardCount[0]);
		j++;
	}
	i++;

	// Test 15 	- deckCount should be 0
	if(state->deckCount[0]==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"deckCount[0]",0,state->deckCount[0]);
		j++;
	}
	i++;

	// Test 16 - handCount should be 11
	if(state->handCount[0]==11)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"handCount[0]",11,state->handCount[0]);
		j++;
	}
	i++;

	// Test 17 - hand[0][10] should be 0
	if(state->hand[0][10]==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][10]",0,state->hand[0][10]);
		j++;
	}
	i++;

	// Test 18 - hand[0][9] should be 0
	if(state->hand[0][9]==0)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][9]",0,state->hand[0][9]);
		j++;
	}
	i++;

	// Test 19 - hand[0][8] should be 1
	if(state->hand[0][8]==1)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][8]",1,state->hand[0][8]);
		j++;
	}
	i++;

	// Test 20 - hand[0][7] should be 2
	if(state->hand[0][7]==2)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][7]",2,state->hand[0][7]);
		j++;
	}
	i++;

	// Test 21 - hand[0][6] should be 3
	if(state->hand[0][6]==3)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][6]",3,state->hand[0][6]);
		j++;
	}
	i++;

	// Test 22 - hand[0][5] should be still be 4
	if(state->hand[0][5]==4)printf("Test %d -- Passed\n",i);
	else
	{
		printf("Test %d -- Failed, %s - was expecting %d but was %d\n",i,"hand[0][5]",4,state->hand[0][5]);
		j++;
	}
	i++;

	free(state);
	printf("Finished Testing Deck To Hand.\n-----------\n");
	printf("%d/%d Tests Passed\n-----------\n",i-j,i);
	return 0;
}

/*
Blank test function


 if()printf("Test %d -- Passed\n",ic);
 else
 {
 printf("Test %d -- Failed\n",ic);
 j++;
 }
 i++;
 ic++;



 int test_(){
 int i, j;
 i = j = 0;
 printf("-----------\nTest _:\n");
 struct gameState * state = (struct gameState *) malloc(sizeof(struct gameState));

 if()printf("Test %d -- Passed\n",i);
 else
 {
 printf("Test %d -- Failed\n",i);
 j++;
 }
 i++;

 free(state);
 printf("Finished Testing _.\n-----------\n");
 printf("%d/%d Tests Passed\n-----------\n",i-j,i);
 return 0;
 }

*/




